package com.com.effectivejava.serializability.example1;

import com.com.effectivejava.serializability.util.ObjectStream;

import java.io.Serializable;
import java.util.logging.Logger;

/**
 * Created by pankaj on 7/19/14.
 */
public class Employee extends Person implements Serializable{
    static Logger logger = Logger.getLogger(Employee.class.getName());

    static {
        logger.setParent(Logger.getLogger(Employee.class.getPackage().getName()));
    }
    public int empId;

    public Employee(int empId, String name) {
        super(name);
        this.name = name;
        this.empId = empId;
    }

//    public Employee(int empId) {
//        this.empId = empId;
//    }

    public static void main(String... a){
        Employee e = new Employee(1,"Clark");

        ObjectStream os = new ObjectStream();
        byte[] data = os.serialize(e);
        Employee e2 = os.deSerialize(data);

        logger.info("id: "+ e2.empId);
        logger.info("name: "+ e2.name);

        logger.info("Finished.");
    }
}
